View Javadoc

1   /*
2    * jGuild Project: jRPM Released under the Apache License (
3    * http://www.apache.org/LICENSE )
4    */
5   package com.jguild.jrpm.io.constant;
6   
7   
8   /***
9    * Bit flags for dependency fields. (e.g. RPMHeaderTag.REQUIRE_FLAGS,
10   * RPMHeaderTag.CONFLICT_FLAGS)
11   *
12   * @author kuss
13   */
14  public class RPMSense implements FlagIf {
15      public static final int _ANY = 0;
16      public static final RPMSense ANY = new RPMSense(_ANY);
17  
18      /*** @todo Legacy.  */
19      public static final int _SERIAL = (1 << 0);
20      public static final RPMSense SERIAL = new RPMSense(_SERIAL);
21      public static final int _LESS = (1 << 1);
22      public static final RPMSense LESS = new RPMSense(_LESS);
23      public static final int _GREATER = (1 << 2);
24      public static final RPMSense GREATER = new RPMSense(_GREATER);
25      public static final int _EQUAL = (1 << 3);
26      public static final RPMSense EQUAL = new RPMSense(_EQUAL);
27  
28      /*** only used internally by builds */
29      public static final int _PROVIDES = (1 << 4);
30      public static final RPMSense PROVIDES = new RPMSense(_PROVIDES);
31  
32      /*** only used internally by builds */
33      public static final int _CONFLICTS = (1 << 5);
34      public static final RPMSense CONFLICTS = new RPMSense(_CONFLICTS);
35  
36      /*** @todo Legacy.  */
37      public static final int _PREREQ = (1 << 6);
38      public static final RPMSense PREREQ = new RPMSense(_PREREQ);
39  
40      /*** only used internally by builds */
41      public static final int _OBSOLETES = (1 << 7);
42      public static final RPMSense OBSOLETES = new RPMSense(_OBSOLETES);
43  
44      /*** Interpreter used by scriptlet.  */
45      public static final int _INTERP = (1 << 8);
46      public static final RPMSense INTERP = new RPMSense(_INTERP);
47  
48      /*** %pre dependency.  */
49      public static final int _SCRIPT_PRE = ((1 << 9) | _PREREQ);
50      public static final RPMSense SCRIPT_PRE = new RPMSense(_SCRIPT_PRE);
51  
52      /*** %post dependency.  */
53      public static final int _SCRIPT_POST = ((1 << 10) | _PREREQ);
54      public static final RPMSense SCRIPT_POST = new RPMSense(_SCRIPT_POST);
55  
56      /*** %preun dependency.  */
57      public static final int _SCRIPT_PREUN = ((1 << 11) | _PREREQ);
58      public static final RPMSense SCRIPT_PREUN = new RPMSense(_SCRIPT_PREUN);
59  
60      /*** %postun dependency.  */
61      public static final int _SCRIPT_POSTUN = ((1 << 12) | _PREREQ);
62      public static final RPMSense SCRIPT_POSTUN = new RPMSense(_SCRIPT_POSTUN);
63  
64      /*** %verify dependency.  */
65      public static final int _SCRIPT_VERIFY = (1 << 13);
66      public static final RPMSense SCRIPT_VERIFY = new RPMSense(_SCRIPT_VERIFY);
67  
68      /*** find-requires generated dependency.  */
69      public static final int _FIND_REQUIRES = (1 << 14);
70      public static final RPMSense FIND_REQUIRES = new RPMSense(_FIND_REQUIRES);
71  
72      /*** find-provides generated dependency.  */
73      public static final int _FIND_PROVIDES = (1 << 15);
74      public static final RPMSense FIND_PROVIDES = new RPMSense(_FIND_PROVIDES);
75  
76      /*** %triggerin dependency.  */
77      public static final int _TRIGGERIN = (1 << 16);
78      public static final RPMSense TRIGGERIN = new RPMSense(_TRIGGERIN);
79  
80      /*** %triggerun dependency.  */
81      public static final int _TRIGGERUN = (1 << 17);
82      public static final RPMSense TRIGGERUN = new RPMSense(_TRIGGERUN);
83  
84      /*** %triggerpostun dependency.  */
85      public static final int _TRIGGERPOSTUN = (1 << 18);
86      public static final RPMSense TRIGGERPOSTUN = new RPMSense(_TRIGGERPOSTUN);
87  
88      // (1 << 19) unused.
89  
90      /*** %prep build dependency.  */
91      public static final int _SCRIPT_PREP = (1 << 20);
92      public static final RPMSense SCRIPT_PREP = new RPMSense(_SCRIPT_PREP);
93  
94      /*** %build build dependency.  */
95      public static final int _SCRIPT_BUILD = (1 << 21);
96      public static final RPMSense SCRIPT_BUILD = new RPMSense(_SCRIPT_BUILD);
97  
98      /*** %install build dependency.  */
99      public static final int _SCRIPT_INSTALL = (1 << 22);
100     public static final RPMSense SCRIPT_INSTALL = new RPMSense(_SCRIPT_INSTALL);
101 
102     /*** %clean build dependency.  */
103     public static final int _SCRIPT_CLEAN = (1 << 23);
104     public static final RPMSense SCRIPT_CLEAN = new RPMSense(_SCRIPT_CLEAN);
105 
106     /*** rpmlib(feature) dependency.  */
107     public static final int _RPMLIB = ((1 << 24) | _PREREQ);
108     public static final RPMSense RPMLIB = new RPMSense(_RPMLIB);
109 
110     /*** @todo Implement %triggerprein.  */
111     public static final int _TRIGGERPREIN = (1 << 25);
112     public static final RPMSense TRIGGERPREIN = new RPMSense(_TRIGGERPREIN);
113     public static final int _KEYRING = (1 << 26);
114     public static final RPMSense KEYRING = new RPMSense(_KEYRING);
115     public static final int _PATCHES = (1 << 27);
116     public static final RPMSense PATCHES = new RPMSense(_PATCHES);
117     public static final int _CONFIG = (1 << 28);
118     public static final RPMSense CONFIG = new RPMSense(_CONFIG);
119 
120     // Some masks
121 
122     /***
123      * Mask to get senses, ie serial,
124      * less, greater, equal.
125      */
126     public static final int _SENSEMASK = 15;
127     public static final RPMSense SENSEMASK = new RPMSense(_SENSEMASK);
128     public static final int _TRIGGER = _TRIGGERIN | _TRIGGERUN | _TRIGGERPOSTUN;
129     public static final RPMSense TRIGGER = new RPMSense(_TRIGGER);
130     public static final int _ALL_REQUIRES_MASK = _INTERP | _SCRIPT_PRE | _SCRIPT_POST | _SCRIPT_PREUN | _SCRIPT_POSTUN | _SCRIPT_VERIFY | _FIND_REQUIRES |
131         _SCRIPT_PREP | _SCRIPT_BUILD | _SCRIPT_INSTALL | _SCRIPT_CLEAN | _RPMLIB | _KEYRING;
132     public static final RPMSense ALL_REQUIRES_MASK = new RPMSense(_ALL_REQUIRES_MASK);
133     private final int flag;
134 
135     private RPMSense(int flag) {
136         this.flag = flag;
137     }
138 
139     /*
140      * @see com.jguild.jrpm.io.constant.FlagIf#value()
141      */
142     public int value() {
143         return flag;
144     }
145 }